package com.nxn.dinner.web.action.dwz;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.nxn.core.service.EntityManager;
import com.nxn.core.utils.DateTimeUtils;
import com.nxn.core.web.action.base.DWZCRUDAction;
import com.nxn.dinner.model.DeliveryOrder;
import com.nxn.dinner.service.DeliveryOrderService;

@Controller("deliveryOrderDwzAction")
@Scope("prototype")
public class DeliveryOrderAction extends DWZCRUDAction<DeliveryOrder, Long> {
	private static final long serialVersionUID = 3778828163102731678L;
	
	@Autowired
	private DeliveryOrderService deliveryOrderService ;
	
	public EntityManager<DeliveryOrder, Long> getServiceImpl() {
		return deliveryOrderService;
	}
	
	@Override
	protected String buildHQL() {
		StringBuilder hqlBuiler = new StringBuilder();
		hqlBuiler.append(super.buildHQL());
		
		hqlBuiler.append(" where createTime > :createTime");
		
		return hqlBuiler.toString();
	}

	@Override
	protected Map<String, Object> buildQueryMap() {
		Map<String, Object> queryMap = new HashMap<String, Object>();
		queryMap.put("createTime", DateTimeUtils.getTodayStartDate());
		
		return queryMap;
	}
	
	
	

}
